<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */
$query = Registry::get('db')->query("SELECT author_id, username, text FROM {prefix}comments ORDER BY date DESC LIMIT 10");
while($data = $query->fetch_array()){
	echo '<tr>';
	if($data['author_id'] != 0){
		$user = getUserDataFromDB($data['author_id']);
        echo '<td>'.$user['display_name'].'</td>';
	}else{
        echo '<td>'.$data['username'].'</td>';
	}
	if(strlen($data['text']) > 50){
        echo '<td>'.substr(strip_tags($data['text']), 0, 50).' ...</td>';
	}else{
        echo '<td>'.strip_tags($data['text']).'</td>';
	}
	echo '</tr>';
}

?>